<?php

namespace app\common\lib;

use PhpOffice\PhpSpreadsheet\Style\Border;
use PhpOffice\PhpSpreadsheet\Style\Fill;

class Spreadsheet
{
    // 设置边框
    public function styleBorderArray($color = '000000'){
        $styleArray = [
            'borders' => [
                'allBorders' => [
                    'borderStyle' => Border::BORDER_THIN,
                    'color' => ['argb' => $color],
                ],
            ],
        ];
        return $styleArray;
    }

    //设置字体
    public function fontArray($color = "FF000000",$size = 11){
        // 设置字体
        $fontArray = [
            'font' => [
                'bold' => true,
                'color' => [
                    'argb' => $color,
                ],
                'size' => $size,
            ],
        ];
        return $fontArray;
    }

    //设置背景色
    public function fillArray($color = "FFFFFFFF"){
        $fillArray = [
            'fill' => [
                'fillType' => Fill::FILL_SOLID,
                'color' => [
                    'argb' => $color,
                ],
            ],
        ];
        return $fillArray;
    }
}
